package com.example.knowman.ObService.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.knowman.ObService.OBlabelCategoryService;
import com.example.knowman.ReturnMessage.Message;
import com.example.knowman.dao.labelCategoryWithStaffNAndKnowCategoryN;
import com.example.knowman.entity.labelCategory;
import com.example.knowman.entity.staffList;
import com.example.knowman.mapper.LabelCategoryMapper;
import com.example.knowman.mapper.StaffListMapper;
import com.example.knowman.service.IKnowCategoryService;
import com.example.knowman.service.IStaffListService;
import com.example.knowman.service.IlabelCategoryService;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;

@Service
public class ObLabelCategoryServiceImpl extends ServiceImpl<LabelCategoryMapper, labelCategory> implements OBlabelCategoryService {


    @Override
    public Integer returnContainKnowCateIdCount(Integer knowCateId) {
        return this.lambdaQuery().select().eq(labelCategory::getKnowCateId,knowCateId).count();
    }

    @Override
    public Map<Integer, labelCategory> getLabelDetails() {
        return this.lambdaQuery().select().list().stream().collect(Collectors.toMap(labelCategory::getLabelCateId, Function.identity()));
    }

    @Override
    public List<labelCategory> getLabelsByKnowCateId(Integer knowCateId) {
        return this.lambdaQuery().select().eq(labelCategory::getKnowCateId,knowCateId)
//                .orderByAsc(labelCategory::getLabelSort)
                .list();
    }


}
